<template>
  <div>
    <el-button type="primary" @click="getLogin">getLogin</el-button>
    <el-button type="primary" @click="postLogin">postLogin</el-button>
    <el-button type="primary" @click="getToken">getToken</el-button>
    <el-button type="primary" @click="getForm">getForm</el-button>
    <el-button type="primary" @click="dialogVisible = true">getUpload</el-button>
    <el-dialog v-model="dialogVisible" title="Tips" width="30%">
      <span><MyUpload></MyUpload></span>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">Cancel</el-button>
          <el-button type="primary" @click="dialogVisible = false">Confirm</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import axios from 'axios'
const dialogVisible = ref(false)
const getLogin = async () => {
  const res = await axios.get('/dev-api/v1/login')
  console.log(res, 'res')
}
const postLogin = async () => {
  const res = await axios.post('/dev-api/v1/submit', { name: 'ldh', age: 18 })
  console.log(res, 'res')
}
const getToken = async () => {
  const res = await axios.get('/dev-api/v1/token', {
    params: { user: 'ldh', password: 18 },
  })
  console.log(res, 'res')
}
const getForm = async () => {
  const formData = new FormData()

  formData.append('user', 'op')
  formData.append('id', 'ces')
  const res = await axios.post('/dev-api/v1/form', formData)
  console.log(res, 'res')
}
</script>
<style lang="scss"></style>
